<html xmlns="http://www.w3.org/1999/xhtml">
    <body>
        <div class="header-content">
            <div class="top-menu">
                <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post" onsubmit="return CheckInput();">
                    <?php
                    $username = "";
                    $password = "";
                    $result = false;

                    if (isset($_REQUEST["logout"]) == true) {
                        session_destroy();
                        $_SESSION["cartname"] = null;
                        $_SESSION["customername"] = null;
                        header("Location: index.php");
                    }
//Kiem tra da dang nhap hay chua
                    if (isset($_SESSION["customername"]) == false) {
                        if (isset($_REQUEST["username"]) && isset($_REQUEST["password"])) {
                            $username = $_REQUEST["username"];
                            $password = $_REQUEST["password"];
                        $records = DataProvider::ExecuteQuery("select * from account");
                        if($records){
                            while ($row = mysql_fetch_array($records, MYSQL_ASSOC)) {
                                if ($username == $row["Username"] && $password ==
                                        $row["Userpassword"]) {
                                    $result = true;
                                    $_SESSION["customername"] = $username;
                                    $_SESSION["cartname"] = new Cart($row["UserID"]);
                                }
                                else{
                                    echo "alert('Bạn cần phải đăng nhập để mua hàng');";
                                }
                        }
                            
                        
                    } else {
                        $result = true;
                    }
                    if ($result == false ) {
                        ?> 
                        <ul class="top-menu-info">
                            <li><input name="username" id="txtUS" class="txtlogin" type="text" title="Tài khoản" placeholder="Tên tài khoản"/></li>
                            <li><input name="password" id="txtPS" class="txtlogin" type="password" title="Mật khẩu" placeholder="Mật khẩu"/></li>
                            <li><input id="btndangnhap" type="submit" value="Đăng nhập" title="Đăng nhập"/></li>
                            <li ><a href="#" title="Đăng ký" class="btn-login">Đăng ký</a></li>
                        </ul>
                    <?php
                    } else {
                        ?>
                        <ul class="top-menu-info">
                            <li class="hello-user"><?php echo ("Xin  chào  " . $_SESSION["customername"]); ?> </li>
                            <li><a href="index.php?logout=1" class="btn-login" title="Đăng xuất">Đăng xuất</a></li>
                            <li><a href="cart.php" class=btn-login>Giỏ hàng</a></li>
                        </ul>
                    <?php } ?></form>
            </div>
            <div class="header-left-block">
                <div class="logo">
                    <a href="index.php"><img src="images/logo.png" width="200"></a>
                </div>
                <div class="policy">
                    <ul>
                        <li class="policy-span">
                            <a href="#"><i class="icon-save"></i>HÀNG HÓA<br>CHÍNH HÃNG</a>
                        </li>
                        <li class="policy-span">
                            <a href="chinh-sach-van-chuyen.php"><i class="icon-transport"></i>GIAO HÀNG<br>MIỄN PHÍ</a>
                        </li>
                        <li class="policy-span">
                            <a href="chinh-sach-van-chuyen.php#payment"><i class="icon-payment"></i>THANH TOÁN<br>LINH HOẠT</a>
                        </li>
                    </ul>
                </div>

            </div>
            <div class="header-right-block">

                <div class="hotline">
                    <span class="hotline-number">
                        <span class="hotline-title">Hỗ trợ và Tư vấn</span>
                        <p>0936 290 292 - 01675 744 022</p>
                    </span>
                </div>
            </div>
            <div class="nav-menu">
                <div class="nav-menu-block">
                    <ul>
                        <li><a href="index.php"><div class="dl-menuwrapper">
                                    <button>Trang chủ</button></a></li>
                        <li>
                            <div id="dl-menu" class="dl-menuwrapper">
                                <button>Sản phẩm</button>
                                <ul class="dl-menu">
                                    <li>
                                        <a href="#">Theo loại</a>
                                        <ul class="dl-submenu">
                                            <li class="dl-back"><a href="#">back</a></li>
                                            <li>
                                                <a href="#">Men</a>
                                            </li>
                                            <li>
                                                <a href="#">Women</a>
                                            </li>
                                            <li>
                                                <a href="#">Children</a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <a href="#">Theo nhà sản xuất</a>
                                        <ul class="dl-submenu">
                                            <li class="dl-back"><a href="#">back</a></li>
                                            <li><a href="#">Camera &amp; Photo</a></li>
                                            <li><a href="#">TV &amp; Home Cinema</a></li>
                                            <li><a href="#">Phones</a></li>
                                            <li><a href="#">PC &amp; Video Games</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </li>
                        <li><a href="contact.php"><div class="dl-menuwrapper">
                                    <button>Liên hệ</button></a></li>
                        <li>
                            <li class="nav-menu-span">
                                <form>
                                    <input class="txt-search-content"type="text" name="searchcontent" placeholder="Tìm kiếm"/>
                                    <input class="btn-search" type="submit" name="search" value="Tìm"/>
                                </form>
                            </li>
                    </ul>
                </div>
            </div>
        </div>
    </body>
</html>
     if (isset($_REQUEST["ProductCatName"])) {
             $records = dataprovider::ExecuteQuery("select b.*, c.ManuName, 
d.OriginName from ((product b inner join origin d on d.OriginID = b.ProductOriID) 
inner join manufacturer c on c.ManuID = b.ProductManuID) where 
b.ProductCat=" . $_REQUEST["ProductCatName"]);
            }
            if (isset($_REQUEST["ManufacturerID"])) {
                $records = dataprovider::ExecuteQuery("select b.*, c.ManuName, 
d.OriginName from ((product b inner join origin d on d.OriginID = b.ProductOriID) 
inner join manufacturer c on c.ManuID = b.ProductManuID) where 
b.ProductManuID=" . $_REQUEST["ManufacturerID"]);
                }
            